package br.ufrj.dcc.smarthotel.controls;

import java.lang.reflect.Type;
import java.util.List;

import br.ufrj.dcc.smarthotel.activities.ServicesMenuActivity;
import br.ufrj.dcc.smarthotel.entities.Service;

import com.google.gson.reflect.TypeToken;

public class ServicesMenuControl extends Control {
	private ServicesMenuActivity activity;
	
	public ServicesMenuControl (ServicesMenuActivity activity) {
		this.activity = activity;
	}

	@SuppressWarnings("unchecked")
	public void loadServices() {
		Type listType = new TypeToken<List<Service>>() {}.getType();
		
		List<Service> servicesList = (List<Service>)this.retrieve(this.baseURI + "service", listType);
		
		this.activity.setServicesList(servicesList);
	}
}
